<template>
  <el-table
    height="400px"
    ref="multipleTableRef"
    :data="ProjectList"
    style="width: 100%"
    @selection-change="handleSelectionChange"
  >
    <el-table-column type="selection" width="55" />
    <el-table-column prop="projectName" label="项目名称">
      <template #default="scope">
        <span style="color: dodgerblue">{{ scope.row.projectName }}</span>
      </template>
    </el-table-column>
    <el-table-column prop="declarantName" label="申报人" />
    <el-table-column prop="dicValue" label="项目来源单位" />
    <el-table-column label="项目级别" />
    <el-table-column prop="declarationTime" label="申报时间" />
    <el-table-column prop="progress" label="项目进度" />
    <el-table-column label="操作">
      <template #default="scope">
        <el-button @click="Review(scope.row.id)" type="text">专家评审</el-button
        >&nbsp;
        <el-button @click="Desc(scope.row.id)" type="text">详情</el-button>
      </template>
    </el-table-column>
  </el-table>
  <div style="text-align: center">
    <el-button @click="Examine()" type="primary">查看评审汇总</el-button>
    <br />
  </div>
  <div v-show="Review" style="text-align: center">
    <table
      style="width: 90%; text-align: left; border-collapse: collapse"
    >
      <thead>
        <tr>
          <th class="table_style"></th>
          <th
            v-for="(item, index) in Reviewstandar"
            :key="index"
            class="table_style"
          >
            {{ item.standarName }}
          </th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th class="table_style">项目名称</th>
          <td
            v-for="(item, index) in Reviewstandar"
            :key="index"
            class="table_style"
          >
            {{ item.remark }}
          </td>
        </tr>
        <tr>
          <td class="table_style">项目申报测试</td>
          <td
            v-for="(item, index) in Reviewstandar"
            :key="index"
            class="table_style"
          >
            <el-input v-model="item.Scope"></el-input>
          </td>
        </tr>
      </tbody>
    </table>

    <el-button @click="Submit()" type="primary">正式提交</el-button>
    <br />
  </div>
</template>

<script>
export default {
  data() {
    return {
      ProjectList: undefined,
      multipleSelection: [],
      Reviewstandar: [],
      Review: false,
    };
  },
  created() {
    this.GetBasicInfo();
  },
  methods: {
    GetBasicInfo() {
      this.http
        .post("api/tb_project_apply_basicinfo/GetBasicInfo")
        .then((res) => {
          this.ProjectList = res.data;
        });
    },
    Examine() {
      var ids = this.multipleSelection.map((x) => x.id);
      this.Review = true;
      this.GetReviewstandar();
      console.log(ids.toString());
    },
    GetReviewstandar() {
      this.http.get("api/tb_project_reviewstandar/list").then((res) => {
        this.Reviewstandar = res.data;
        console.log(this.Reviewstandar);
      });
    },
    //专家评审
    Review(id) {},
    //详情
    Desc(id) {},
    //正式提交
    Submit() {},
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
  },
};
</script>

<style>
.table_style {
  border: 1px solid #ccc;
  height: 50px;
  text-align: center;
}
</style>